/*
 * Created on Tue Dec 28 15:48:52 CET 2010
 */

/* 
 * This Bundle implements a service who simulate a sensor and expose the wind value regularly.
 */

package org.ece.meteo.capteurVent;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {
  
	static BundleContext BC;
	Thread c_vent1;	
	
	/**
	 * Implements Activator.start(). Prints that it is starting,
	 * implements c_vent1 as CapteurVent() thread and start it. 
	 * @param context the framework context for the bundle.
	**/
  public void start(BundleContext context) throws Exception {
	  BC = context;
	  c_vent1 = new CapteurVent();
	  c_vent1.start(); // Start thread
	  System.out.println("> org.ece.meteo.capteurVent started");
  }

	/**
	 * Implements Activator.stop(). Prints that it is stopping and
	 * stop the CapteurVent() thread. 
	 * @param context the framework context for the bundle.
	**/
  public void stop(BundleContext context) throws Exception {
	   ((CapteurVent) c_vent1).halt();	// stop thread
		System.out.println("> org.ece.meteo.capteurVent resolved");
  }
}

